package gui.frames.internos;

import controle.gui.frames.internos.ControlePreferencias;
import gui.componentes.JTextFieldCodigo;

/**
 *
 * @author Maycon
 */
public class IFPreferencias extends javax.swing.JInternalFrame {

    private ControlePreferencias controle = new ControlePreferencias(this);

    /**
     * Creates new form InternalFramePreferencias
     */
    public IFPreferencias() {
        initComponents();
        setVisible(true);

        inicializa();
    }
    
    public void inicializa(){
        controle.inicializa();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TabbedPaneOpcoes = new javax.swing.JTabbedPane();
        panelBancoDeDados = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        comboDuracao = new javax.swing.JComboBox();
        panelSincronizacao = new javax.swing.JPanel();
        panelInformacoes = new javax.swing.JPanel();
        labelPorta = new javax.swing.JLabel();
        textPorta = new JTextFieldCodigo(5, true);
        jPanel1 = new javax.swing.JPanel();
        textChefeDaTurma = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        panelBotoes = new javax.swing.JPanel();
        buttonOk = new javax.swing.JButton();
        buttonCancelar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setTitle("Preferências");

        TabbedPaneOpcoes.setBackground(new java.awt.Color(204, 204, 204));
        TabbedPaneOpcoes.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tempo de validade dos registros de transações feitas pelos usuários:", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 0)));

        comboDuracao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Nunca", "15 dias", "30 dias", "60 dias", "120 dias", "365 dias", " " }));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(comboDuracao, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 242, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(comboDuracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(48, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout panelBancoDeDadosLayout = new javax.swing.GroupLayout(panelBancoDeDados);
        panelBancoDeDados.setLayout(panelBancoDeDadosLayout);
        panelBancoDeDadosLayout.setHorizontalGroup(
            panelBancoDeDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        panelBancoDeDadosLayout.setVerticalGroup(
            panelBancoDeDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        TabbedPaneOpcoes.addTab("Banco De Dados", panelBancoDeDados);

        panelInformacoes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Socket", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        labelPorta.setText("Porta:");

        javax.swing.GroupLayout panelInformacoesLayout = new javax.swing.GroupLayout(panelInformacoes);
        panelInformacoes.setLayout(panelInformacoesLayout);
        panelInformacoesLayout.setHorizontalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addComponent(labelPorta)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textPorta, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(292, Short.MAX_VALUE))
        );
        panelInformacoesLayout.setVerticalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelPorta)
                    .addComponent(textPorta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(46, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout panelSincronizacaoLayout = new javax.swing.GroupLayout(panelSincronizacao);
        panelSincronizacao.setLayout(panelSincronizacaoLayout);
        panelSincronizacaoLayout.setHorizontalGroup(
            panelSincronizacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelInformacoes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        panelSincronizacaoLayout.setVerticalGroup(
            panelSincronizacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelInformacoes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        TabbedPaneOpcoes.addTab("Sincronização", panelSincronizacao);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informações:", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        jLabel1.setText("Chefe da Turma:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textChefeDaTurma, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textChefeDaTurma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap(46, Short.MAX_VALUE))
        );

        TabbedPaneOpcoes.addTab("Informações", jPanel1);

        panelBotoes.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Confirma.png"))); // NOI18N
        buttonOk.setText("Ok");
        buttonOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonOkActionPerformed(evt);
            }
        });

        buttonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Cancelar.png"))); // NOI18N
        buttonCancelar.setText("Cancelar");
        buttonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBotoesLayout = new javax.swing.GroupLayout(panelBotoes);
        panelBotoes.setLayout(panelBotoesLayout);
        panelBotoesLayout.setHorizontalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBotoesLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(buttonOk)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCancelar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelBotoesLayout.setVerticalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBotoesLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonOk)
                    .addComponent(buttonCancelar))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelBotoes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(TabbedPaneOpcoes)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(TabbedPaneOpcoes)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelBotoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelarActionPerformed
        this.dispose();
    }//GEN-LAST:event_buttonCancelarActionPerformed

    private void buttonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOkActionPerformed
        controle.salvarPreferencias();
        this.dispose();
    }//GEN-LAST:event_buttonOkActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane TabbedPaneOpcoes;
    private javax.swing.JButton buttonCancelar;
    private javax.swing.JButton buttonOk;
    public javax.swing.JComboBox comboDuracao;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel labelPorta;
    private javax.swing.JPanel panelBancoDeDados;
    private javax.swing.JPanel panelBotoes;
    private javax.swing.JPanel panelInformacoes;
    private javax.swing.JPanel panelSincronizacao;
    private javax.swing.JTextField textChefeDaTurma;
    private javax.swing.JTextField textPorta;
    // End of variables declaration//GEN-END:variables

    public ControlePreferencias getControle() {
        return controle;
    }

    public void setControle(ControlePreferencias controle) {
        this.controle = controle;
    }

    public javax.swing.JTabbedPane getTabbedPaneOpcoes() {
        return TabbedPaneOpcoes;
    }

    public void setTabbedPaneOpcoes(javax.swing.JTabbedPane TabbedPaneOpcoes) {
        this.TabbedPaneOpcoes = TabbedPaneOpcoes;
    }

    public javax.swing.JButton getButtonCancelar() {
        return buttonCancelar;
    }

    public void setButtonCancelar(javax.swing.JButton buttonCancelar) {
        this.buttonCancelar = buttonCancelar;
    }

    public javax.swing.JButton getButtonOk() {
        return buttonOk;
    }

    public void setButtonOk(javax.swing.JButton buttonOk) {
        this.buttonOk = buttonOk;
    }

    public javax.swing.JComboBox getComboDuracao() {
        return comboDuracao;
    }

    public void setComboDuracao(javax.swing.JComboBox comboDuracao) {
        this.comboDuracao = comboDuracao;
    }

    public javax.swing.JPanel getjPanel2() {
        return jPanel2;
    }

    public void setjPanel2(javax.swing.JPanel jPanel2) {
        this.jPanel2 = jPanel2;
    }

    public javax.swing.JLabel getLabelPorta() {
        return labelPorta;
    }

    public void setLabelPorta(javax.swing.JLabel labelPorta) {
        this.labelPorta = labelPorta;
    }

    public javax.swing.JPanel getPanelBancoDeDados() {
        return panelBancoDeDados;
    }

    public void setPanelBancoDeDados(javax.swing.JPanel panelBancoDeDados) {
        this.panelBancoDeDados = panelBancoDeDados;
    }

    public javax.swing.JPanel getPanelBotoes() {
        return panelBotoes;
    }

    public void setPanelBotoes(javax.swing.JPanel panelBotoes) {
        this.panelBotoes = panelBotoes;
    }

    public javax.swing.JPanel getPanelInformacoes() {
        return panelInformacoes;
    }

    public void setPanelInformacoes(javax.swing.JPanel panelInformacoes) {
        this.panelInformacoes = panelInformacoes;
    }

    public javax.swing.JPanel getPanelSincronizacao() {
        return panelSincronizacao;
    }

    public void setPanelSincronizacao(javax.swing.JPanel panelSincronizacao) {
        this.panelSincronizacao = panelSincronizacao;
    }

    public javax.swing.JTextField getTextPorta() {
        return textPorta;
    }

    public void setTextPorta(javax.swing.JTextField textPorta) {
        this.textPorta = textPorta;
    }

    public javax.swing.JTextField getTextChefeDaTurma() {
        return textChefeDaTurma;
    }

    public void setTextChefeDaTurma(javax.swing.JTextField textChefeDaTurma) {
        this.textChefeDaTurma = textChefeDaTurma;
    }

    
}
